#include <bits/stdc++.h>
// 2025/03/23
// tag: 
// Author: Forever
using namespace std;
using int64 = int64_t;

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    while (n--){
        int k;
        cin >> k;
        if (k % 3 == 1)
            cout << "YES" << endl;
        else
            cout << "NO" << endl;
    }
    return 0;
}